![]() |
ALMaSS
1.0
The Animal, Landscape and Man Simulation System
|
#include <Roe_all.h>
Public Member Functions | |
virtual void | On_IsDead (Roe_Base *Someone, int whos_dead, bool fawn) |
virtual void | On_ChangeGroup (int newgroup) |
virtual void | On_MumAbandon (Roe_Female *mum) |
virtual void | BeginStep (void) |
virtual void | Step (void) |
virtual void | EndStep (void) |
virtual void | On_EndGroup () |
Roe_Fawn (int x, int y, int size, int group, bool sex, Landscape *L, RoeDeer_Population_Manager *RPM) | |
virtual | ~Roe_Fawn () |
![]() | |
unsigned | IsAlive () |
int | SupplyReserves () |
virtual void | Send_IsDead () |
RoeDeerInfo | SupplyInfo () |
virtual int | WhatState () |
Roe_Base (int x, int y, Landscape *L, RoeDeer_Population_Manager *RPM) | |
virtual | ~Roe_Base () |
![]() | |
unsigned | SupplyFarmOwnerRef () |
AnimalPosition | SupplyPosition () |
APoint | SupplyPoint () |
int | SupplyPolygonRef () |
int | Supply_m_Location_x () |
int | Supply_m_Location_y () |
virtual void | KillThis () |
virtual void | CopyMyself () |
void | SetX (int a_x) |
void | SetY (int a_y) |
TAnimal (int x, int y, Landscape *L) | |
virtual void | ReinitialiseObject (int x, int y, Landscape *L) |
Used to re-use an object - must be implemented in descendent classes. More... | |
virtual void | Dying () |
void | CheckManagement (void) |
void | CheckManagementXY (int x, int y) |
virtual bool | OnFarmEvent (FarmToDo) |
![]() | |
int | GetCurrentStateNo () |
Returns the current state number. More... | |
void | SetCurrentStateNo (int a_num) |
Sets the current state number. More... | |
bool | GetStepDone () |
Returns the step done indicator flag. More... | |
void | SetStepDone (bool a_bool) |
Sets the step done indicator flag. More... | |
virtual void | ReinitialiseObject () |
Used to re-use an object - must be implemented in descendent classes. More... | |
TALMaSSObject () | |
The constructor for TALMaSSObject. More... | |
virtual | ~TALMaSSObject () |
The destructor for TALMaSSObject. More... | |
void | OnArrayBoundsError () |
Used for debugging only, tests basic object properties. More... | |
Public Attributes | |
int | m_MyGroup |
int | m_MinInState [6] |
![]() | |
TRoeDeerStates | CurrentRState |
RoeDeer_Population_Manager * | m_OurPopulation |
int | m_Age |
int | m_Size |
int | m_RangeCentre_x |
int | m_RangeCentre_y |
int | m_Reserves |
double | m_HomeRange |
int | m_OldRange_x |
int | m_OldRange_y |
int | m_SearchRange |
bool | m_float |
bool | m_Disperse |
bool | m_HaveRange |
Roe_Female * | Mum |
int | m_ID |
int | m_FixlistNumber |
bool | m_Sex |
bool | m_IsDead |
unsigned | Alive |
Protected Member Functions | |
void | CareCounter (int state) |
void | SelectBedSite () |
int | RunTo (int mum_x, int mum_y, bool p_IsSafe) |
void | Mature () |
void | Send_InitCare () |
void | On_UpdateGroup (int p_group_x, int p_group_y) |
void | On_ApproachOfDanger (int p_To_x, int p_To_y) |
![]() | |
bool | Running (int x, int y) |
void | Ignore (int p_To_x, int p_To_y) |
int | DistanceTo (int p_x, int p_y, int p_To_x, int p_To_y) |
int | DistanceToCC (int p_x, int p_y, int p_To_x, int p_To_y) |
int | DirectionTo (int p_x, int p_y, int p_To_x, int p_To_y) |
int | DirectionToCC (int p_x, int p_y, int p_To_x, int p_To_y) |
int | NextStep (int weight, int dir, int recurselevel) |
int | AssessHabitat (int polyref) |
int | AssessHabitat (int p_x, int p_y) |
int | LegalHabitat (int p_x, int p_y) |
int | LegalHabitatCC (int p_x, int p_y) |
int | Cover (int polyref) |
Calls the cover calculation for a given polyref. More... | |
int | Cover (int p_x, int p_y) |
Calls the cover calculation for a given x,y location. More... | |
int | CalcCover (TTypesOfLandscapeElement a_ele, int a_poly) |
The cover calculation for a given element type. More... | |
int | CoverCC (int p_x, int p_y) |
int | NutriValue (int polyref) |
int | NutriValue (int p_x, int p_y) |
int | NutriValueCC (int p_x, int p_y) |
int | Feeding (bool p_Disperse) |
void | SeekCover (int threshold) |
void | SeekNutri (int p_threshold) |
int | ProbRoadCross (int p_x, int p_y, int p_width) |
double | CalculateRoadMortality (int p_x, int p_y, int p_width) |
void | WalkTo (int pos_x, int pos_y) |
void | WalkToCC (int pos_x, int pos_y) |
![]() | |
void | CorrectWrapRound () |
Corrects wrap around co-ordinate problems. More... | |
Protected Attributes | |
Roe_Base * | m_MySiblings [3] |
int | BedSiteList [15][2] |
int | m_Agegroup |
bool | m_Mature |
int | m_MinHourlyCare |
bool | m_Orphan |
bool | m_InHide |
int | m_Bedsite_x |
int | m_BedSite_y |
unsigned | m_Count |
int | m_CareLastHour [6] |
int | m_memorypointer |
![]() | |
int | timestep |
int | m_Cross_x |
int | m_Cross_y |
double | m_EnergyGained |
int | m_RecovCount |
int | m_RumiCount |
int | m_FeedCount |
int | m_LengthFeedPeriod |
int | m_LengthRuminate |
int | m_LastState |
int | m_danger_x |
int | m_danger_y |
int | m_distrc |
int | m_weightedstep |
int | SimW |
int | SimH |
![]() | |
int | m_Location_x |
int | m_Location_y |
Landscape * | m_OurLandscape |
![]() | |
int | m_CurrentStateNo |
The basic state number for all objects - '-1' indicates death. More... | |
bool | m_StepDone |
Indicates whether the iterative step code is done for this timestep. More... | |
Private Member Functions | |
int | FAInit (void) |
int | FASuckle (void) |
int | FAFeed (void) |
int | FARuminate (void) |
int | FAHide (void) |
int | FARecover (void) |
int | FARunToMother (void) |
int | FAOnNewDay (void) |
int | FAUpdateEnergy (void) |
int | FADie (void) |
Roe_Fawn::Roe_Fawn | ( | int | x, |
int | y, | ||
int | size, | ||
int | group, | ||
bool | sex, | ||
Landscape * | L, | ||
RoeDeer_Population_Manager * | RPM | ||
) |
Roe_Fawn::Roe_Fawn - constructor for fawn object. Sets all attributes.
References BedSiteList, Roe_Base::m_Age, m_Agegroup, m_Bedsite_x, m_BedSite_y, m_CareLastHour, m_Count, m_InHide, Roe_Base::m_IsDead, Roe_Base::m_LastState, Roe_Base::m_LengthFeedPeriod, m_Mature, m_memorypointer, m_MinHourlyCare, m_MinInState, m_MyGroup, m_MySiblings, m_Orphan, Roe_Base::m_Reserves, Roe_Base::m_SearchRange, Roe_Base::m_Sex, and Roe_Base::m_Size.
|
virtual |
References m_MyGroup, m_MySiblings, Roe_Base::m_OurPopulation, and RoeDeer_Population_Manager::RemoveFromGroup().
|
virtual |
Roe_Fawn::BeginStep - checks if fawn object is dead
Reimplemented from Roe_Base.
References Roe_Base::CurrentRState, Roe_Base::IsAlive(), TAnimal::m_OurLandscape, rds_FADeathState, and Landscape::Warn().
|
protected |
Roe_Fawn::CareCounter - is called at the beginning of every timestep and keeps track of dynamic list that counts last 6 timesteps as '1' if fawn has received the required care and '0' if not.
References m_CareLastHour, m_Count, TAnimal::m_OurLandscape, and Landscape::Warn().
Referenced by FAFeed(), FAHide(), FARecover(), FARuminate(), FARunToMother(), and FASuckle().
|
virtual |
Roe_Fawn::EndStep - checks if fawn object is dead and adds to number of timesteps. If 1 whole day has passed, current state is set to FOnNewDay
Reimplemented from Roe_Base.
References Roe_Base::CurrentRState, Roe_Base::IsAlive(), TAnimal::m_OurLandscape, Roe_Base::m_OurPopulation, Roe_Base::m_weightedstep, rds_FADeathState, rds_FAOnNewDay, RoeDeer_Population_Manager::StepCounter, Roe_Base::timestep, and Landscape::Warn().
|
private |
Roe_Fawn::FADie - function for managing death of a fawn object. The fawn object sends message to siblings and mom. The fawn adds itself to list of dead animals. Function returns dead state. Calls functions On_IsDead().
References RoeDeer_Population_Manager::DeadList, Roe_Base::IsAlive(), Roe_Base::m_Age, TALMaSSObject::m_CurrentStateNo, m_MySiblings, TAnimal::m_OurLandscape, Roe_Base::m_OurPopulation, Roe_Base::m_Sex, Roe_Base::Mum, Roe_Base::On_IsDead(), Roe_Female::On_IsDead(), and Landscape::Warn().
Referenced by Step().
|
private |
Roe_Fawn::FAFeed - Determines possible energy gain per minute feeding of fawn object by looking at nutritional value of habitat, and thuis determines if habitat is suited for feeding. If so adds nutritional value to the energy gained by the fawn object. If the fawn is not an orphan fawn is weighted back towards mother (via a simple semi-random walk) if too far away. Orphans are weighted back towards their rangecentre instead. If the feeding time of the fawn object is long enough state is set to ruminate, else to stay in feeding state. If fawn object is less than 60 days old, it may initiate a suckle period or set state to hide. Calls functions NutriValue(), SupplyPosition(), DistanceTo(), On_InitCare(), DirectionTo()
References CareCounter(), Roe_Base::DirectionTo(), Roe_Base::DistanceTo(), IntakeRate, Roe_Base::IsAlive(), Roe_Base::m_Age, m_Agegroup, m_CareLastHour, Roe_Base::m_EnergyGained, Roe_Base::m_FeedCount, Roe_Base::m_LastState, Roe_Base::m_LengthFeedPeriod, Roe_Base::m_LengthRuminate, TAnimal::m_Location_x, TAnimal::m_Location_y, m_MinInState, m_Orphan, TAnimal::m_OurLandscape, Roe_Base::m_RangeCentre_x, Roe_Base::m_RangeCentre_y, AnimalPosition::m_x, AnimalPosition::m_y, MaxDistToMum, Minhrcare, MinNutri, Roe_Base::Mum, Roe_Base::NextStep(), Roe_Base::NutriValue(), Roe_Female::On_InitCare(), Landscape::SupplyMonth(), TAnimal::SupplyPosition(), and Landscape::Warn().
Referenced by Step().
|
private |
Roe_Fawn::FAHide - only fawn objects less than 60 days can be in the hide state. Sets fawn to hide and select hiding spot. The fawn will leave hide only if flushed or hungry. If fawns has been in hiding for more than 1 time step it will check if it is in need of care and is hungry. If so it may initiate a suckling session (if mother accepts) or if old enough to feed a feeding session. Checks if mother is dead, and if so the fawn will also die. Calls functions SelectBedSite(), On_InitCare(),
References CareCounter(), Roe_Base::IsAlive(), Roe_Base::m_Age, m_Agegroup, m_CareLastHour, m_InHide, Roe_Base::m_IsDead, Roe_Base::m_LastState, m_MinInState, TAnimal::m_OurLandscape, Minhrcare, Roe_Base::Mum, Roe_Female::On_InitCare(), SelectBedSite(), and Landscape::Warn().
Referenced by Step().
|
private |
Roe_Fawn::FAInit - initial state of fawn object. Keeps track of mother and siblings. Returns suckling state. Calls SupplyInfo().
References Roe_Base::IsAlive(), RoeDeerInfo::m_Age, Roe_Base::m_Age, m_MySiblings, Roe_Female::m_MyYoung, TAnimal::m_OurLandscape, Roe_Base::Mum, Roe_Base::SupplyInfo(), and Landscape::Warn().
Referenced by Step().
|
private |
Roe_Fawn::FAOnNewDay - updates age of fawn object (+ 1 day), if age = 365 days, fawns is set to mature (creates an adult object) and fawn object dies. Checks for fawn mortality and updates age group of fawn. Calls functions Mature().
References FawnDMR, Roe_Base::IsAlive(), Roe_Base::m_Age, m_Agegroup, TAnimal::m_OurLandscape, Mature(), random(), and Landscape::Warn().
Referenced by Step().
|
private |
Roe_Fawn::FARecover - Recovery from reaction to a disturbance. Fawn may return to last state, a new state such as suckling, feeding or hiding (if less than 14 days old) or may stay in the recovery state. Calls function On_InitCare()
References AverageRecoveryTime, CareCounter(), Roe_Base::IsAlive(), Roe_Base::m_Age, Roe_Base::m_FeedCount, Roe_Base::m_LastState, m_MinInState, TAnimal::m_OurLandscape, Roe_Base::m_RecovCount, MaxRecoveryTime, Roe_Base::Mum, Roe_Female::On_InitCare(), random(), and Landscape::Warn().
Referenced by Step().
|
private |
Roe_Fawn::FARuminate - Function for ruminating. When fawns are older than 2 month their ruminating activity is equal to an adult. Checks for good spot to rest and amount of time spent ruminating. Ruminate activity cannot be seperated from other kinds of inactivity. It is also assumed that ruminating takes place while recovering after disturbance. Need to count amount of time spend in this state during this period of ruminating and in total last 24 hrs. Returns values for either stay ruminating, feed or dispersal (or die). Calls function Cover().
References CareCounter(), Roe_Base::Cover(), CoverThreshold1, CoverThreshold2, Roe_Base::IsAlive(), Roe_Base::m_Age, Roe_Base::m_IsDead, Roe_Base::m_LastState, Roe_Base::m_LengthRuminate, TAnimal::m_Location_x, TAnimal::m_Location_y, m_MinInState, TAnimal::m_OurLandscape, Roe_Base::m_RumiCount, Roe_Base::SeekCover(), Landscape::SupplyMonth(), and Landscape::Warn().
Referenced by Step().
|
private |
Roe_Fawn::FARunToMother - the fawn object gets it's mothers position and will run to her avoiding non-habitat. Calls SupplyPosition(), RunTo()
References CareCounter(), Roe_Base::IsAlive(), Roe_Base::m_Age, Roe_Base::m_IsDead, m_MinInState, TAnimal::m_OurLandscape, AnimalPosition::m_x, AnimalPosition::m_y, Roe_Base::Mum, RunTo(), TAnimal::SupplyPosition(), and Landscape::Warn().
Referenced by Step().
|
private |
Roe_Fawn::FASuckle - Sets energy gain from suckling as 75000 per 10 minutes. The fawn object can only be in this state if CanSuckle=true. A careperiod cannot last more than 1 timestep. Sets care counter (if fawns is < 60 days) and determines whether fawn want to initiate another careperiod and whether or not it is still hungry (dependent on minimum care time for age group) and wants to initiate more suckling ( which may be refused by mother). Either returns states suckling, feed (if mother refused suckling), or hide if fawn is less than 14 days. Calls functions On_InitCare(), SupplyPosition(), DistanceTo(), WalkTo(), On_EndCare()
References CareCounter(), Roe_Base::DistanceTo(), Roe_Base::IsAlive(), Roe_Base::m_Age, m_Agegroup, m_CareLastHour, Roe_Base::m_EnergyGained, Roe_Base::m_LastState, TAnimal::m_Location_x, TAnimal::m_Location_y, m_MinInState, TAnimal::m_OurLandscape, AnimalPosition::m_x, AnimalPosition::m_y, Minhrcare, Roe_Base::Mum, Roe_Female::On_EndCare(), Roe_Female::On_InitCare(), TAnimal::SupplyPosition(), Roe_Base::WalkTo(), and Landscape::Warn().
Referenced by Step().
|
private |
Roe_Fawn::FAUpdateEnergy - Calculates how much energy is used (in cal/minute) in different activities. Calculates net energy (gained-used) and determines whether excess enery is added to reserves (fawns do not have reserves the first 2 months, if negative energy balance they immediately loose weight) or is used to put on weight. A negative net energy causes the fawn object to loose weight - if fawn weight falls below a minimum value, it will die. If the fawn is in very bad condition it will increase forage time. Returns states such as feed or die.
References Anabolic_Inv, Catabolic_Inv, CostFawnAct, FawnRMR, Female_FeedBouts, Roe_Base::IsAlive(), Roe_Base::m_Age, m_Agegroup, Roe_Base::m_EnergyGained, Roe_Base::m_LastState, Roe_Base::m_LengthFeedPeriod, m_MinInState, TAnimal::m_OurLandscape, Roe_Base::m_Reserves, Roe_Base::m_Size, MinWeightFawn, Landscape::SupplyMonth(), and Landscape::Warn().
Referenced by Step().
|
protected |
Roe_Fawn::Mature - maturation of fawn into adult. Creates new adult object (male of female) in same geographical place as fawn and sets adult properties. Calls CreateObjects().
References Deer_struct::age, RoeDeer_Population_Manager::CreateObjects(), Deer_struct::group, Deer_struct::ID, Roe_Base::m_Age, Roe_Base::m_ID, TAnimal::m_Location_x, TAnimal::m_Location_y, m_Mature, m_MyGroup, TAnimal::m_OurLandscape, Roe_Base::m_OurPopulation, Roe_Base::m_Sex, Roe_Base::m_Size, Roe_Base::Mum, Deer_struct::mum, Deer_struct::Pop, Deer_struct::size, Deer_struct::x, and Deer_struct::y.
Referenced by FAOnNewDay().
|
protected |
Roe_Fawn::On_ApproachOfDanger - determines fawn behavior when exposed to a threath. When fawn < 60 days it either hides or runs to mother depending on flush distance (this is again depending on age group of fawn). When > 60 days it always runs either towards mother (if not an orphan) or away from threath. Calls DistanceTo(), Running().
References Roe_Base::CurrentRState, Roe_Base::DistanceTo(), Flush_dist, Roe_Base::m_Age, m_Agegroup, Roe_Base::m_IsDead, TAnimal::m_Location_x, TAnimal::m_Location_y, m_Orphan, rds_FADie, rds_FAHide, rds_FARecover, rds_FARunToMother, and Roe_Base::Running().
|
virtual |
Roe_Fawn::On_ChangeGroup - removes fawn object from old group and add it to new group. Calls RemoveFromGroup(), AddToGroup().
Reimplemented from Roe_Base.
References RoeDeer_Population_Manager::AddToGroup(), m_MyGroup, Roe_Base::m_OurPopulation, and RoeDeer_Population_Manager::RemoveFromGroup().
|
virtual |
Reimplemented from Roe_Base.
|
virtual |
Roe_Fawn::On_IsDead - governs a fawn objects "response" to death of another object. If dead object is mother and fawn is less than 60days, the fawn will die. Else it is set to be an orphan. If same-age sibling is dead, sibling is removed from sibling list.
Reimplemented from Roe_Base.
References Roe_Base::CurrentRState, Roe_Base::IsAlive(), Roe_Base::m_Age, Roe_Base::m_IsDead, m_MySiblings, m_Orphan, TAnimal::m_OurLandscape, Roe_Base::Mum, rds_FADie, and Landscape::Warn().
|
virtual |
Roe_Fawn::On_MumAbandon - fawn response to mother abandoning it. Mum is deleted, if fawn is less than 2 months it will die, otherwise it is set as orphaned.
Reimplemented from Roe_Base.
References Roe_Base::CurrentRState, Roe_Base::m_Age, Roe_Base::m_IsDead, m_Orphan, TAnimal::m_OurLandscape, Roe_Base::Mum, rds_FADie, and Landscape::Warn().
|
protectedvirtual |
Reimplemented from Roe_Base.
|
protected |
Roe_Fawn::RunTo - directed movement towards mothers position, all habitat except lethal habitat is used. Roads can be crossed and probability of dying is calculated. Calls functions DirectionTo(), DistanceTo(), SupplyElementType(), SupplyRoadWidth(), CalculateRoadMortality(),
References Roe_Base::CalculateRoadMortality(), Roe_Base::DirectionTo(), Roe_Base::DistanceTo(), Roe_Base::m_danger_x, Roe_Base::m_danger_y, Roe_Base::m_IsDead, TAnimal::m_Location_x, TAnimal::m_Location_y, TAnimal::m_OurLandscape, random(), Landscape::SupplyElementType(), Landscape::SupplyRoadWidth(), tole_LargeRoad, tole_SmallRoad, Vector_x, and Vector_y.
Referenced by FARunToMother().
|
protected |
Roe_Fawn::SelectBedSite - function for selecting a good spot to hide. Fawn ob ject checks habitat type at location. Good habitat is forest type vegetation, or open land if vegetation is high enough. New bed site is added to bed site list. If not able to find new bed site search bed site list and move to closest bed site. Calls SupplyElementType(), SupplyVegHeight(), DistanceTo(), WalkTo(), SeekCover().
References BedSiteList, Roe_Base::DistanceTo(), TAnimal::m_Location_x, TAnimal::m_Location_y, m_memorypointer, TAnimal::m_OurLandscape, Roe_Base::SeekCover(), Landscape::SupplyVegHeight(), tole_Hedges, tole_PitDisused, tole_Railway, tole_StoneWall, Roe_Base::WalkTo(), and Landscape::Warn().
Referenced by FAHide().
|
protected |
Roe_Fawn::Send_InitCare - sends message to mother asking if it can feed. If message returns true, the fawn will be in the suckle state, otherwise feeding state.
References Roe_Base::CurrentRState, TAnimal::m_OurLandscape, Roe_Base::Mum, Roe_Female::On_InitCare(), rds_FAFeed, rds_FASuckle, and Landscape::Warn().
|
virtual |
Roe_Fawn::Step - function called every time step. The functions checks if done with a given state (m_StepDone) and governs states and transitions to other states. Calls functions: FAInit(), FADie(), FAOnNEwDay(), FAUpdateEnergy(), FASuckle(), FAFeed(), FARuminate(), FARunToMother(), FARecover(), FAHide().
Reimplemented from Roe_Base.
References Roe_Base::CurrentRState, FADie(), FAFeed(), FAHide(), FAInit(), FAOnNewDay(), FARecover(), FARuminate(), FARunToMother(), FASuckle(), FAUpdateEnergy(), Roe_Base::IsAlive(), TAnimal::m_OurLandscape, TALMaSSObject::m_StepDone, rds_FADeathState, rds_FADie, rds_FAFeed, rds_FAHide, rds_FAInit, rds_FAOnNewDay, rds_FARecover, rds_FARuminate, rds_FARunToMother, rds_FASuckle, rds_FAUpdateEnergy, rds_Initialise, and Landscape::Warn().
|
protected |
Referenced by Roe_Fawn(), and SelectBedSite().
|
protected |
Referenced by FAFeed(), FAHide(), FAOnNewDay(), FASuckle(), FAUpdateEnergy(), On_ApproachOfDanger(), and Roe_Fawn().
|
protected |
Referenced by Roe_Fawn().
|
protected |
Referenced by Roe_Fawn().
|
protected |
Referenced by CareCounter(), FAFeed(), FAHide(), FASuckle(), and Roe_Fawn().
|
protected |
Referenced by CareCounter(), and Roe_Fawn().
|
protected |
Referenced by FAHide(), and Roe_Fawn().
|
protected |
Referenced by Mature(), and Roe_Fawn().
|
protected |
Referenced by Roe_Fawn(), and SelectBedSite().
|
protected |
Referenced by Roe_Fawn().
int Roe_Fawn::m_MinInState[6] |
Referenced by FAFeed(), FAHide(), FARecover(), FARuminate(), FARunToMother(), FASuckle(), FAUpdateEnergy(), and Roe_Fawn().
int Roe_Fawn::m_MyGroup |
Referenced by Mature(), On_ChangeGroup(), Roe_Fawn(), and ~Roe_Fawn().
|
protected |
Referenced by FADie(), FAInit(), On_IsDead(), Roe_Fawn(), and ~Roe_Fawn().
|
protected |
Referenced by FAFeed(), On_ApproachOfDanger(), On_IsDead(), On_MumAbandon(), and Roe_Fawn().